﻿using Entity.Models.BaseEntitys;
using Entity.Models.Entities;
using System;
using System.Collections.Generic;
using System.Text;

namespace Entity.Models.dto
{
    /// <summary>
    /// 耗材DTO 类
    /// </summary>
    public class ConsumableInfoDTO
    {
        /// <summary>
        /// id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        public string _description { get; set; }

        /// <summary>
        /// 耗材类型id
        /// </summary>
        public string _categoryId { get; set; }

        /// <summary>
        /// 耗材名称
        /// </summary>
        public string _consumableName { get; set; }

        /// <summary>
        /// 耗材规格
        /// </summary>
        public string _specification { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        public int _num { get; set; }

        /// <summary>
        /// 单位
        /// </summary>
        public string _unit { get; set; }

        /// <summary>
        /// 价格
        /// </summary>
        public decimal _money { get; set; }

        /// <summary>
        /// 警告库存
        /// </summary>
        public int _warningNum { get; set; }


        /// <summary>
        /// 创建时间
        /// </summary>
        public string _createTime { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime _createTimes { get; set; }

        //构造
        public ConsumableInfoDTO(ConsumableInfo consumableInfo, Category category)
        {
            Id = consumableInfo.Id;
            _description = consumableInfo.Description;
            _categoryId = category.CategoryName==null?"": category.CategoryName;
            _consumableName = _consumableName;
            _specification = _specification;
            _num = consumableInfo.Num;
            _unit = consumableInfo.Unit;
            _money = consumableInfo.Money;
            _warningNum = consumableInfo.WarningNum;
            _createTime = consumableInfo.CreateTime.ToString();
        }
        public ConsumableInfoDTO(ConsumableInfoDTO consumableInfo)
        {
            Id = consumableInfo.Id;
            _description = consumableInfo._description;
            _categoryId = consumableInfo._categoryId;
            _consumableName = consumableInfo._consumableName;
            _specification = consumableInfo._specification;
            _num = consumableInfo._num;
            _unit = consumableInfo._unit;
            _money = consumableInfo._money;
            _warningNum = consumableInfo._warningNum;
            _createTime = consumableInfo._createTimes.ToString("yyyy-MM-dd HH:mm:ss");
        }

        public ConsumableInfoDTO()
        {
        }
    }
}
